"use strict";
/// <reference path="./index.d.ts" />
var jsapp;
/// <reference path="./index.d.ts" />
(function (jsapp) {
    var App = /** @class */ (function () {
        function App() {
            this.timer = 0;
            this.count = 0;
        }
        App.prototype.Init = function () {
            CS.TT.Log("hello world from js", CS.LogLevel.Normal);
            CS.TT.SetEvent_OnUpdate(this.OnUpdate);
            var names = CS.TT.RootPack.GetAllResourceName();
            for (var i = 0; i < names.Length; i++) {
                CS.TT.Log("res=" + names.get_Item(i));
            }
            //let font = CS.TTFont.FromAssetByName("hzk16");
            //CS.TT.Log("load hzk16.");
            for (var i = 0; i < 100; i++) {
                CS.TT.Log("count=" + i);
                var t = this.LoadTex("cat");
            }
            //let  ct = this.LoadTex("cat");
            //let  ct2 = this.LoadTex("cat");
        };
        App.prototype.OnUpdate = function (delta) {
            this.timer += delta;
            if (this.timer > 1.0) {
                this.timer = 0;
                this.count++;
                CS.TT.Log("tick from js.");
            }
            //if (count > 5)
            //    throw "fucked.";
        };
        App.prototype.LoadTex = function (name) {
            CS.TT.Log("LoadTex 0:" + name);
            var img = CS.TTImg.FromAssetByName(name);
            CS.TT.Log("LoadTex 2 TTimg:" + img.Name);
            return img;
        };
        return App;
    }());
    jsapp.App = App;
})(jsapp || (jsapp = {}));
/// <reference path="./app.ts" />
//这里为了用System 输出单个js，无模块代码，要用上面  的reference 语法
//不要用 import
//class 要放在namespace中
var app = new jsapp.App();
app.Init();
